home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ident / tools / tcplist-1.1.shar / utils.h < prev   
Encoding:
C/C++ Source or Header  |  1993-07-14  |  1.6 KB  |  60 lines

  1. /* new - mallocs any sized type */
  2. #ifndef lint
  3. #define new(t) (t *)mylib_malloc(sizeof(t),__FILE__,__LINE__)
  4. #else
  5. #define new(t) (t *)NULL
  6. #endif
  7.  
  8. /* mem - mallocs a given number of bytes */
  9. #define mem(l) mylib_malloc((unsigned)l,__FILE__,__LINE__)
  10.  
  11. /* rmem - reallocs a given number of bytes */
  12. #define rmem(c,l) mylib_realloc(c,(unsigned)l,__FILE__,__LINE__)
  13.  
  14. /* s - returns a copy of a given string */
  15. #define s(c) mylib_scopy(c,__FILE__,__LINE__)
  16.  
  17. /* rs - returns a copy of the second string in place of the first string, 
  18.         using realloc */
  19. #define rs(c,d) mylib_srcopy(c,strlen(d),__FILE__,__LINE__)
  20.  
  21. /* assert - error message if statement is false */
  22. #ifdef DEBUG
  23. #define assert(c) if(!(c))(void)fprintf(stderr,"%s: %d: Assert false\n",__FILE__,__LINE__)
  24. #else
  25. #define assert(c) 0
  26. #endif
  27.  
  28. /* STREQ - indicate whether two strings are equal */
  29. #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
  30.  
  31. #define loop for(;;)
  32. #define NUL(x) (x)NULL
  33. #ifndef TRUE
  34. #define TRUE 1 
  35. #endif
  36. #ifndef FALSE
  37. #define FALSE 0 
  38. #endif
  39. #define YES 1
  40. #define NO 0
  41.  
  42. /* Error - print like fprintf(stderr, ...) and die. Progname included at
  43.        beginning of message, newline at end. */
  44. extern void Error();
  45. /* Warning - like error, without dying */
  46. extern void Warning();
  47.  
  48. extern char *mylib_malloc();   
  49. extern char *mylib_realloc();
  50. extern char *mylib_scopy();
  51. extern char *mylib_srcopy();
  52. extern char *cat();
  53. extern char *getstr();
  54. extern FILE *efopen();
  55. extern void efclose();
  56. extern void dfprintf();
  57.  
  58. extern char *progname; /* application's name. Used by Error, Warning. */
  59. extern int d; /* debug level */
  60.